import 'package:flutter/material.dart';

import './1.dart';
import './2.dart';
import './3.dart';
import './4.dart';

class Index extends StatefulWidget {
  @override
  _IndexState createState() => _IndexState();
}

class _IndexState extends State<Index> {
 int _currentIndex = 0;

  List<Widget> _pageList = [
    HomePage(),
    NewsPage(),
    CartPage(),
    PersonPage(),

  ];

  List<BottomNavigationBarItem> _barItem = [
    BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('首页')),
    BottomNavigationBarItem(icon: Icon(Icons.list), title: Text('列表')),
    BottomNavigationBarItem(icon: Icon(Icons.people), title: Text('我的')),
    BottomNavigationBarItem(icon: Icon(Icons.hd), title: Text('画质')),
  ];

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          actions: <Widget>[
              IconButton(
                  icon: Icon(Icons.music_video),
                  onPressed: () {
                    // Utils.showToast(context, '啦啦1');
                    
                  }),
            ],
          title: Text('Em yêu Cục cưng'),
          backgroundColor: Colors.red,
        ),
        body: this._pageList[this._currentIndex],
        bottomNavigationBar: BottomNavigationBar(
          onTap: (int index) {
            setState(() {
              this._currentIndex = index;
            });
          },
          currentIndex: this._currentIndex,
          items: _barItem,
          fixedColor: Colors.pink,
          selectedFontSize: 12,
          type: BottomNavigationBarType.fixed,
        ),
      ),
    );
  }
}
